package com.library.librarybackend.domain;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

/**
 * @author 平
 * @description 请求分页参数
 * @since 2025-09-21 20:52
 */
@Data
public class RequestWithPage {

    @NotNull
    @Schema(description = "页码")
    private Long page = 1L;

    @NotNull
    @Schema(description = "每页数量")
    private Long pageSize = 20L;

    public static <T> Page<T> of(Long page, Long pageSize) {
        return Page.of(page, pageSize);
    }

    public <T> Page<T> toPage() {
        return of(page, pageSize);
    }

}
